package estrategia;

import java.io.IOException;

import javax.vecmath.Point3d;

import comunicacion.Conector;

public class PredictorDaemon extends Thread {
	
	private static final long TIEMPO_ENTRE_LECTURAS = 80;
	private Conector entorno;
	private Predictor predictor;
	
	public PredictorDaemon(Conector entorno, Predictor predictor) {
		this.entorno = entorno;
		
		this.predictor = predictor;
	}
	
	public void run() {
		while (true) {
			try {
				Thread.sleep(TIEMPO_ENTRE_LECTURAS);
			} catch (InterruptedException e) {}
			
			try {
				Point3d[] nuevasCoordenadas = entorno.getCoordenadasObjetos();
				predictor.actualizarHistoriales(nuevasCoordenadas);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
